<template>
  <view class="">
    <view class="success" v-show="isshow">
      <image src="../../../static/tduck/success.png" class="images"></image>
      <view class="text">支付成功</view>
    </view>
    <view class="success" v-show="isshows">
      <image src="../../../static/tduck/fail.png" class="images"></image>
      <view class="text">支付失败</view>
    </view>
  </view>
</template>

<script>
  export default {
    data() {
      return {
        payData: {},
        isshow: false,
        isshows: false
      }
    },
    onLoad(options) {
      const payData = JSON.parse(decodeURIComponent(options.payDataStr))
      this.payData = payData
      this.pay()
    },
    methods: {
      pay() {
        let that = this
        uni.requestPayment({
          'timeStamp': this.payData.timeStamp,
          'nonceStr': this.payData.nonceStr, //随机串
          'package': this.payData.packageValue, //配置支付id值
          'signType': this.payData.signType, //微信签名方式
          'paySign': this.payData.paySign, //微信签名
          success(res) {
            that.isshow = true
          },
          fail(e) {
            that.isshows = true
          }
        })
      }
    }
  }
</script>

<style>
  .success {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    margin-top: 200rpx;
  }

  .images {
    width: 80px;
    height: 80px;
  }

  .text {
    font-size: 40rpx;
    margin-top: 30rpx;
  }
</style>